package com.zl.awesome.current.join;

/**
 * @Author: zl
 * @Date: 2021/9/28 15:10
 */
public class JoinTest2 {
    public static void main(String[] args) throws InterruptedException {
        Thread threadOne = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
                System.out.println("child threadOne over");
            }
        });

        Thread threadTwo = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                }catch (InterruptedException e){
                    e.printStackTrace();
                }
                System.out.println("child threadTwo over");
            }
        });
        //start child thread
        threadOne.start();
        threadTwo.start();
        System.out.println("wait all child thread over");
        //wait child thread execute over
        threadOne.join();
        threadTwo.join();
        System.out.println("all child thread over");
    }
}
